package mq;

import com.aliyun.openservices.ons.api.Action;
import com.aliyun.openservices.ons.api.ConsumeContext;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.MessageListener;

public class MessageListenerImpl implements MessageListener {
        @Override
        public Action consume(Message message, ConsumeContext context) {
            try {
                doConsumeMessage(message);
            } catch (Throwable e) {
                //捕获消费逻辑中的所有异常，并返回 Action.CommitMessage;
                return Action.ReconsumeLater;
            }
            //消息处理正常，直接返回 Action.CommitMessage;
            return Action.CommitMessage;
        }

    private void doConsumeMessage(Message message) {
        Message msg = new Message("MQ_TOPIC","TagA","Hello MQ".getBytes());


    }
}